/**
 * 玩家數據類
 * @author LuoDong
 * @email luo4521@online.net.tw
 */
package com.addcn.texas.data
{	
	import flash.display.Bitmap;
	
	public class  User 
	{		
		public var id : int;  //玩家ID
		public var name : String; //玩家昵稱
		public var gold : uint;  // 玩家點數
		public var level : int;  //玩家等級	
		public var label : String;  //玩家称号
		public var photo : String   //玩家照片地址	
		public var pic : Object;  //玩家照片位圖				
		public var friends : Array;  //好友id		
		public var game : Boolean; //是否在进行游戏
		//public var roomid : int ; //当前所在房间
					
		function User() : void
		{
			name = "";						
			friends  = [];
		}
		
		/**
		 * 初始化玩家數據 
		 * @param	r_data Object 
		 * 	{id:int ,name:int ,gold:int, level:int ,photo:String, thumb:bitMap, }
		 */
		public function initialize(r_data : Object) : void
		{
			this.id    = r_data["id"];
			this.name  = r_data["name"];
			this.gold  = r_data["gold"];
			this.level = r_data["level"];
			this.label = r_data["label"];
			this.photo = r_data["photo"];	
			//this.roomid = r_data["roomid"];
		}		
		
		public function getUserInfo() : Object
		{
			var _obj : Object = { };
			_obj["id"] = id;
			_obj["name"] = name;
			_obj["gold"] = gold;
			_obj["level"] = level;
			_obj["label"] = label;
			_obj["pic"] = pic;			
		//	_obj["roomid"] = roomid;
			return _obj;			
		}
		
		/**
		 * 銷毀數據
		 */
		public function destroy() : void
		{					
			this.pic = null;			
		}
		
	}
	
}
